/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entity;

import java.io.Serializable;
import java.sql.Date;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;

/**
 *
 * @author cheeseng
 */
@Entity 
public class SalesItem implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long itemId;
    @ManyToOne(cascade = {CascadeType.PERSIST}) 
    private PurchaseOrder purchaseOrder;
    @ManyToOne(cascade = {CascadeType.PERSIST})
    private SalesInquiry saleInquiry;
    @ManyToOne(cascade = {CascadeType.PERSIST})
    private SalesOrder saleOrder;
    @ManyToOne(cascade = {CascadeType.PERSIST})
    private Invoice invoice;
    @OneToOne(cascade = {CascadeType.PERSIST})
    private SystemUser createdBy;   
    private Integer quantity;
    private Double unitPrice;
    private Double price;
    private String discount;
    private String description;

    public SalesItem() { 
    }

    public void create(Integer quantity, Double unitPrice, Double price, String discount, String description, Date createdDate) {
        this.quantity = quantity;
        this.unitPrice = unitPrice;
        this.price = price;
        this.discount = discount;
        this.description = description; 

    }

    public SystemUser getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(SystemUser createdBy) {
        this.createdBy = createdBy;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getDiscount() {
        return discount;
    }

    public void setDiscount(String discount) {
        this.discount = discount;
    }

    public Invoice getInvoice() {
        return invoice;
    }

    public void setInvoice(Invoice invoice) {
        this.invoice = invoice;
    }

    public Long getItemId() {
        return itemId;
    }

    public void setItemId(Long itemId) {
        this.itemId = itemId;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public PurchaseOrder getPurchaseOrder() {
        return purchaseOrder;
    }

    public void setPurchaseOrder(PurchaseOrder purchaseOrder) {
        this.purchaseOrder = purchaseOrder;
    }

    public Integer getQuantity() {
        return quantity;
    }

    public void setQuantity(Integer quantity) {
        this.quantity = quantity;
    }

    public SalesInquiry getSaleInquiry() {
        return saleInquiry;
    }

    public void setSaleInquiry(SalesInquiry saleInquiry) {
        this.saleInquiry = saleInquiry;
    }

    public SalesOrder getSaleOrder() {
        return saleOrder;
    }

    public void setSaleOrder(SalesOrder saleOrder) {
        this.saleOrder = saleOrder;
    }

    public Double getUnitPrice() {
        return unitPrice;
    }

    public void setUnitPrice(Double unitPrice) {
        this.unitPrice = unitPrice;
    }


}
